<template>
  <view class="content">
    <view class="header">
      <view class="userInfo">
        <u-image
          width="28px"
          height="25px"
          src="@/static/images/icon.png"
        ></u-image>
        <text>试试我们最好的影院</text>
      </view>
      <view class="position">
        <view class="point">
          <u-image
            width="22px"
            height="30px"
            src="@/static/images/position.png"
          ></u-image>
          <text>成都</text>
        </view>
        <view>
          <u-image
            width="25px"
            height="20px"
            src="@/static/images/down.png"
          ></u-image>
        </view>
      </view>
    </view>
    <view class="building-list">
      <view
        class="building-item"
        v-for="item in dataSource"
        :key="item.id"
        @click="toDetail(item.id)"
      >
        <view class="img">
          <u-image
            :src="require('@/static/images/building/' + item.img_src)"
            width="98px"
            height="62px"
          ></u-image>
        </view>
        <view class="detail">
          <view class="name">{{ item.name }}</view>
          <view class="address">{{ item.address }}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script lang="ts">
import { defineComponent, ref } from '@vue/composition-api';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const data = require('@/mock/building/index.json');
import PAGE from '@/const/page';

export default defineComponent({
  onLoad() {
    this.dataSource = data.operas;
  },
  setup() {
    const dataSource = ref([]);
    return {
      dataSource,
    };
  },
  methods: {
    toDetail(id: string) {
      uni.navigateTo({
        url: PAGE.BUILDING_DETAIL.PATH + '?id=' + id,
      });
    },
  },
});
</script>

<style lang="scss" scoped>
.header {
  width: 100%;
  height: 300rpx;
  background-image: url('@/static/images/chooseSeat.png');
  background-size: cover;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;

  .userInfo {
    display: flex;
    color: white;
    font-size: 38rpx;
    font-weight: 700;
    margin-left: 48rpx;
    margin-bottom: 50rpx;

    text {
      margin-left: 18rpx;
    }
  }

  .position {
    width: 100%;
    height: 88rpx;
    background-color: rgba(255, 255, 255, 0.3);
    padding: 0 64rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .point {
      display: flex;
      font-size: 36rpx;
      color: white;

      text {
        margin-left: 18rpx;
      }
    }
  }
}
.building-list {
  padding-left: 32rpx;

  .building-item {
    margin-top: 44rpx;
    display: flex;

    .detail {
      margin-left: 32rpx;

      .name {
        font-size: 32rpx;
        font-weight: 700;
      }

      .address {
        font-size: 24rpx;
        color: #666;
        margin-top: 10rpx;
      }
    }
  }
}
</style>
